//
//  MoreViewController.m
//  盘盈贷1.2
//
//  Created by iOS on 15/3/6.
//  Copyright (c) 2015年 iOS. All rights reserved.
//

#import "MoreViewController.h"
#import "UIImageView+WebCache.h"
@interface MoreViewController ()<UITableViewDataSource, UITableViewDelegate>
@property (nonatomic, retain) NSMutableArray *myself;
@property (nonatomic, retain) NSMutableArray *shezhi;
@property (nonatomic, retain) NSMutableArray *guanyu;
@property (nonatomic, retain)NSMutableArray *a;
@property (nonatomic, retain)UITableView *tableView;
@property (nonatomic, retain)NSMutableArray *arr;

@end

@implementation MoreViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        
        self.title = @"更多";
        self.myself = [NSMutableArray arrayWithObjects:@"          活动中心", @"          消息中心", @"          帮助中心", nil];
        self.shezhi = [NSMutableArray arrayWithObjects:@"          转发好友", @"          意见反馈", @"          关注我们", nil];
        self.guanyu = [NSMutableArray arrayWithObjects: @"         检查更新", @"          关于我们", nil];
        self.a = [NSMutableArray arrayWithObjects:@"", nil];
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStylePlain];
   // self.tableView.backgroundColor = [UIColor lightGrayColor];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.scrollEnabled = NO;
    [self.view addSubview:self.tableView];
    
    UIImageView *image1 = [[UIImageView alloc] initWithFrame:CGRectMake(20, 23, 30, 30)];
    [image1 setImage: [UIImage imageNamed:@"活动中心.png"]];
    [self.tableView addSubview:image1];
    
    UIImageView *image2 = [[UIImageView alloc] initWithFrame:CGRectMake(20, 70, 30, 30)];
    [image2 setImage:[UIImage imageNamed:@"消息中心.png"]];
    [self.tableView addSubview:image2];
    
    UIImageView *image3 = [[UIImageView alloc] initWithFrame:CGRectMake(20, 120, 30, 30)];
    [image3 setImage:[UIImage imageNamed:@"帮助中心.png"]];
    [self.tableView addSubview:image3];
    
    UIImageView *image4 = [[UIImageView alloc] initWithFrame:CGRectMake(20, 180, 30, 30)];
    [image4 setImage:[UIImage imageNamed:@"转发好友.png"]];
    [self.tableView addSubview:image4];
    
    
    UIImageView *image5 = [[UIImageView alloc] initWithFrame:CGRectMake(20, 230, 30, 30)];
    [image5 setImage:[UIImage imageNamed:@"意见反馈.png"]];
    [self.tableView addSubview:image5];
    
    UIImageView *image6 = [[UIImageView alloc] initWithFrame:CGRectMake(20, 280, 30, 30)];
    [image6 setImage:[UIImage imageNamed:@"关注我们.png"]];
    [self.tableView addSubview:image6];
    
    UIImageView *image7 = [[UIImageView alloc] initWithFrame:CGRectMake(15 , 330, 40, 40)];
    [image7 setImage:[UIImage imageNamed:@"检查更新.png"]];
    [self.tableView addSubview:image7];
    
    UIImageView *image8 = [[UIImageView alloc] initWithFrame:CGRectMake(20, 390, 30, 30)];
    [image8 setImage:[UIImage imageNamed:@"关于我们.png"]];
    [self.tableView addSubview:image8];
    [self.tableView release];

}
//设置tableview 每个分区(section)显示多少行(row)
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    
    switch (section) {
        case 0:
            return self.myself.count;
            break;
        case 1:
            return self.shezhi.count;
            break;
        case 2:
            return self.guanyu.count;
            break;
            default:
        return self.a.count;
    }
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    if (section == 0) {
        
        return 10;
    } else if (section == 3){
        return 24.0;
    } else {
        return 10.0;
    }
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    return 50;
    
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    if (indexPath.section == 0) {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"1"];
        if (cell == nil) {
            cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"0"];
        }
        cell.textLabel.text = self.myself[indexPath.row];
         cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        return cell;
    } else if (indexPath.section == 1) {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"1"];
        if (cell == nil) {
            cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"1"];
        }
        cell.textLabel.text = self.shezhi [indexPath.row];
         cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        return cell;
        
    } else {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"3"];
        if (cell == nil) {
            cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"3"];
        }
        cell.textLabel.text = self.guanyu [indexPath.row];
         cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        return cell;
    }
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 4;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
